//package com.newtouch.avmarketing.mongo.service;
//
//import com.newtouch.avmarketing.mongo.dao.CommentRepo;
//import com.newtouch.avmarketing.mongo.po.Comment;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.data.domain.Page;
//import org.springframework.data.domain.PageRequest;
//import org.springframework.stereotype.Service;
//
//import java.util.List;
//
//@Service
//public class CommentService {
//
//    @Autowired
//    private CommentRepo commentRepo;
//
//    public List<Comment> findBynicknameAndId(String nickname){
//        List<Comment> list = commentRepo.findBynicknameContaining(nickname);
//        return list;
//    }
//
//    public Page<Comment> findByParentid(String parentid, int page, int size){
//        return commentRepo.findByParentid(parentid, PageRequest.of(page-1,size));
//    }
//
//    public void saveComment(Comment comment){
//        commentRepo.save(comment);
//    }
//
//    public void updateComment(Comment comment){
//        commentRepo.save(comment);
//    }
//    public void deleteCommentById(String id){
//        commentRepo.deleteById(id);
//    }
//    public List<Comment> findComments(){
//        List<Comment> all = commentRepo.findAll();
//        return all;
//    }
//
//    public Comment findCommentById(String id){
//        Comment comment = commentRepo.findById(id).get();
//        return comment;
//    }
//
//}
